package com.beiing.tianshuai.tianshuai.huodong.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.entity.EventTypesBean;
import com.beiing.tianshuai.tianshuai.entity.VersionInfoBean;
import com.beiing.tianshuai.tianshuai.huodong.model.HuoDongModel;
import com.beiing.tianshuai.tianshuai.huodong.model.HuoDongModelImpl;
import com.beiing.tianshuai.tianshuai.huodong.view.HuoDongViewImpl;

/**
 * Created by magikliu on 2017/7/7.
 */

public class HuoDongPresenter extends BasePresenter implements HuoDongPresenterImpl, HuoDongModel.OnRequestListener {

    public static final String TAG = "HuoDongPresenter";

    private HuoDongViewImpl mHuoDongView;
    private HuoDongModelImpl mHuoDongModel;

    public HuoDongPresenter(HuoDongViewImpl mHuoDongView) {
        this.mHuoDongView = mHuoDongView;
        this.mHuoDongModel = new HuoDongModel(this);
    }

    @Override
    public void getTabTitles() {
        mHuoDongView.showProgress();
        mHuoDongModel.getTabTitles();
    }

    @Override
    public void getVersionInfo() {
        mHuoDongModel.getVersionInfo();
    }

    @Override
    public void onRequestVersionInfoSuccess(VersionInfoBean bean) {
        mHuoDongView.getVersionInfo(bean);
    }

    @Override
    public void onSuccess(EventTypesBean bean) {
        mHuoDongView.hideProgress();
        mHuoDongView.onRequestSuccess(bean);
    }

    @Override
    public void onError(Throwable e) {
        mHuoDongView.hideProgress();
        mHuoDongView.onRequestFailed(e);
    }
}
